from application.enumeration.ContentTypeEnum import ContentTypeEnum
from application.model import TortoiseBaseModel
from tortoise.fields import BigIntField, CharEnumField


class ViewLogModel(TortoiseBaseModel):
    """
    浏览记录表
    """
    user_id: int = BigIntField(null=False, description="用户ID")
    target_id: int = BigIntField(null=False, description="浏览目标ID")
    content_type: str = CharEnumField(enum_type=ContentTypeEnum, max_length=5, null=True,
                                      description="浏览的内容类型，帖子等等")

    class Meta:
        table: str = "view_log"
        table_description: str = "浏览记录表"
